home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2005 March / Gamestar_71_2005-03_dvd.iso / Dema / willofsteel_demo.exe / {app} / Data / Shaders / decal14sf.fx < prev    next >
Text File  |  2004-10-23  |  4KB  |  179 lines

  1. float4x4 WorldViewProjection;
  2. float4x4 ShadowViewProjection;
  3. float4x4 TextureMatrix;
  4. float4x4 DecalMatrix;
  5.  
  6. texture AlphaTexture;
  7. texture DiffuseTexture;
  8. texture ShadowTexture;
  9. texture CloudsTexture;
  10. texture FogOfWar;
  11.  
  12. float3 LightDirection = { 0.0f, 0.0f, 0.0f };
  13. float3 SunColor       = { 1., 0.86, .70f  };
  14. float3 Ambient        = { 0.24, 0.12, 0.0f };
  15. float4 DecalColor     = { 0., 0., 0., 0. };
  16. float4 ShadowOffset;
  17.  
  18. float4 FogScale          = { 0.001953125, 0.001953125, 0.001953125, 0.001953125 };    
  19. float4 ZBias          = { 0.0, 0.0, 0.0, -0.004 };
  20.  
  21. float4 CloudUVShift    = { 0.0, 0.0, 0.0, 0.0 };
  22. float4 CloudScale      = { 0.01, 0.01, 0.01, 0.01 };
  23. float4 BlinkFactor     = { 0.0, 0.0, 0.0, 0.0 };
  24.  
  25.  
  26. technique Technique0
  27. {
  28.     pass Pass0
  29.     {
  30.         Texture[0]               = (DiffuseTexture);
  31.         Texture[1]               = (ShadowTexture);
  32.         Texture[2]               = (FogOfWar);
  33.  
  34.         VertexShaderConstant[0]   = <WorldViewProjection>;
  35.         VertexShaderConstant[4]   = <ShadowViewProjection>;
  36.         VertexShaderConstant[8]   = <TextureMatrix>;
  37.         VertexShaderConstant[19]  = <DecalColor>;
  38.         VertexShaderConstant[20]  = <DecalMatrix>;
  39.         VertexShaderConstant[26]  = <BlinkFactor>;
  40.         VertexShaderConstant[27]  = <FogScale>;
  41.         VertexShaderConstant[30]  = <LightDirection>;
  42.         VertexShaderConstant[31]  = <ZBias>;
  43.         VertexShaderConstant[32]  = <SunColor>;
  44.  
  45.         VertexShader =
  46.         decl
  47.         {
  48.             stream 0;
  49.             float v0[3];       
  50.             float v3[3];       
  51.             float v6[2];       
  52.         }
  53.         asm
  54.         {
  55.             vs_1_1
  56.  
  57.             dcl_position v0
  58.             dcl_normal v3
  59.             dcl_texcoord0  v6
  60.  
  61.             m4x4  oPos, v0, c0    
  62.             mul   r0, v0, c27    
  63.             mov   oT2.x, r0.x   
  64.             mov   oT2.y, r0.z   
  65.             m4x4  r0, v0, c12    
  66.             mov   oT0, v6        
  67.             dp4   oT1.x, v0, c8 
  68.             dp4   oT1.y, v0, c9
  69.             dp3   r0, v3, c30
  70.             mul   r0, r0, c32
  71.             mov   r0.a, c19.a
  72.             mul   oD0, r0, c26
  73.             dp4   r0, v0, c6        
  74.             add   oT3.x, r0, c31.w  
  75.         };
  76.  
  77.         PixelShaderConstant[17]  = <Ambient>;
  78.  
  79.         PixelShader =
  80.         asm
  81.         {
  82.             ps_1_4
  83.               def c0, 1, 1, 1, 1
  84.             def c1, 0.0, 0.0, 0.0, 0
  85.             
  86.             dcl t0.xy
  87.             dcl t1.xyzw
  88.             dcl t2.xy
  89.             dcl t3.xy
  90.             dcl v0.rgba
  91.  
  92.             dcl_2d s0
  93.             dcl_2d s1
  94.             dcl_2d s2
  95.             
  96.             texld   r10, t1, s1           
  97.             sub     r9.r, r10.r, t3.x  
  98.             mov     r1, c1             
  99.             cmp     r10, r9.r, c0, r1  
  100.             texld   r1, t0, s0
  101.             mul     r0, r10, v0
  102.             mov     r0.a, c0.x
  103.             add     r0, r0, c17
  104.             texld   r2, t2, s2
  105.             mul     r0, r2, r0
  106.             mul     r0, r1, r0
  107.             mul     r0.a, r0.a, v0.a
  108.             mov     oC0, r0        
  109.         };
  110.     }
  111. }
  112.  
  113.  
  114.  
  115. technique Technique1
  116. {
  117.     pass Pass0
  118.     {
  119.         Texture[0]               = (DiffuseTexture);
  120.         Texture[1]               = (ShadowTexture);
  121.         Texture[2]               = (FogOfWar);
  122.  
  123.         VertexShaderConstant[0]   = <WorldViewProjection>;
  124.         VertexShaderConstant[4]   = <ShadowViewProjection>;
  125.         VertexShaderConstant[8]   = <TextureMatrix>;
  126.         VertexShaderConstant[19]  = <DecalColor>;
  127.         VertexShaderConstant[26]  = <BlinkFactor>;
  128.         VertexShaderConstant[27]  = <FogScale>;
  129.         VertexShaderConstant[30]  = <LightDirection>;
  130.         VertexShaderConstant[31]  = <ZBias>;
  131.         VertexShaderConstant[32]  = <SunColor>;
  132.  
  133.         VertexShader =
  134.         decl
  135.         {
  136.             stream 0;
  137.             float v0[3];      
  138.             float v3[3];      
  139.             float v6[2];      
  140.         }
  141.         asm
  142.         {
  143.             vs_1_1
  144.  
  145.             dcl_position v0
  146.             dcl_normal v3
  147.             dcl_texcoord0  v6
  148.  
  149.             m4x4  oPos, v0, c0        
  150.             mul   r0, v0, c27        
  151.             mov   oT2.x, r0.x       
  152.             mov   oT2.y, r0.z       
  153.             mov   oT0, v6            
  154.             dp4   oT1.x, v0, c8     
  155.             dp4   oT1.y, v0, c9
  156.             dp3   r0, v3, c30
  157.             mul   r0, r0, c32
  158.             mov   r0.a, c19.a
  159.             add  oD0, r0, c26
  160.             dp4   r0, v0, c6        
  161.             add   oT3.x, r0, c31.w  
  162.             mul  oD0, v6, c26
  163.             dp4   r0, v0, c6        
  164.             add   oT3.x, r0, c31.w  
  165.         };
  166.  
  167.         PixelShaderConstant[0]  = <Ambient>;
  168.  
  169.         PixelShader =
  170.         asm
  171.         {
  172.             ps_1_1
  173.             tex  t0
  174.             mov  r0, t0
  175.             mul  r0.a, r0.a, v0.a
  176.         };
  177.     }
  178. }
  179.